package com.handu.luna.core.domain.search;

import java.util.List;

import com.handu.luna.core.domain.goods.Category;

/**
 * @title:Search4Portal.java
 * @package com.handu.luna.core.domain.search
 * @author 张恒强
 * @date 2014年9月2日 上午9:30:53
 * @version V1.0
 */
public class Search4Portal {
	public final static int DEFAULT_PAGE_SIZE = 40;
	public final static int SEARCH_PAGE_SIZE = 48;
	public enum Order{
		
		COMMON("综合排序"),SALESVOLUME("销量"),CREATED("新品"),PRICE("价格");
		
		public String description;
		
		private Order(String description){
			this.description = description;
		}
		
	}
	
	public enum SearchOrCategory{
		SEARCH,CATEGORY;
	}
	
	public enum Direction{
		ASC,DESC;
	}
	
	private String name;
	
	private String brand;//前台参数
	
	private List<Long> categorys;//支持选择了父分类 将其下面所有的子分类下的商品全部查找出
	
	private String parentCategory;//支持分类页左侧分类的总分类的展开
	
	private String parentCategoryname;//支持面包屑
	
	private List<Category> parentcategorys;//多层父级的面包屑展示
	
	private String category;//前台参数
	
	private Category currentCategory;
	
	private String categoryname;
	
	private String brandname;
	
	private String[] goodAttributes;//前台参数
	
	private String maxprice;//前台参数
	
	private String minprice;//前台参数
	
	private boolean isPromotion;//前台参数
	
	private boolean isPost4Free;//前台参数
	
	private Order order = Order.COMMON;
	
	private Direction direction = Direction.DESC;
	
	private int page = 0;
	
	@SuppressWarnings("unused")
	private int pagesize;
	
	private SearchOrCategory sc;
	
	public SearchOrCategory getSc() {
		return sc;
	}

	public void setSc(SearchOrCategory sc) {
		this.sc = sc;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public int getPagesize() {
		if(this.sc.equals(SearchOrCategory.CATEGORY)){
			return DEFAULT_PAGE_SIZE;
		}else if(this.sc.equals(SearchOrCategory.SEARCH)){
			return SEARCH_PAGE_SIZE;
		}else{
			return DEFAULT_PAGE_SIZE;
		}
	}

	public void setPagesize(int pagesize) {
		this.pagesize = pagesize;
	}

	public Order getOrder() {
		return order;
	}

	public void setOrder(Order order) {
		this.order = order;
	}

	public Direction getDirection() {
		return direction;
	}

	public void setDirection(Direction direction) {
		this.direction = direction;
	}

	public String getBrand() {
		return brand;
	}

	public void setBrand(String brand) {
		this.brand = brand;
	}

	public String[] getGoodAttributes() {
		return goodAttributes;
	}

	public void setGoodAttributes(String[] goodAttributes) {
		this.goodAttributes = goodAttributes;
	}

	public String getMaxprice() {
		return maxprice;
	}

	public void setMaxprice(String maxprice) {
		if(maxprice.matches("^[0-9]+(.[0-9]*)?$"))
		this.maxprice = maxprice;
	}

	public String getMinprice() {
		return minprice;
	}

	public void setMinprice(String minprice) {
		if(minprice.matches("^[0-9]+(.[0-9]*)?$"))
		this.minprice = minprice;
	}

	public boolean getIsPromotion() {
		return isPromotion;
	}

	public void setIsPromotion(boolean isPromotion) {
		this.isPromotion = isPromotion;
	}

	public boolean getIsPost4Free() {
		return isPost4Free;
	}

	public void setIsPost4Free(boolean isPost4Free) {
		this.isPost4Free = isPost4Free;
	}

	public String getBrandname() {
		return brandname;
	}

	public void setBrandname(String brandname) {
		this.brandname = brandname;
	}

	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public String getCategoryname() {
		return categoryname;
	}

	public void setCategoryname(String categoryname) {
		this.categoryname = categoryname;
	}

	public String getParentCategory() {
		return parentCategory;
	}

	public void setParentCategory(String parentCategory) {
		this.parentCategory = parentCategory;
	}

	public String getParentCategoryname() {
		return parentCategoryname;
	}

	public void setParentCategoryname(String parentCategoryname) {
		this.parentCategoryname = parentCategoryname;
	}

	public List<Long> getCategorys() {
		return categorys;
	}

	public void setCategorys(List<Long> categorys) {
		this.categorys = categorys;
	}

	public List<Category> getParentcategorys() {
		return parentcategorys;
	}

	public void setParentcategorys(List<Category> parentcategorys) {
		this.parentcategorys = parentcategorys;
	}

	public Category getCurrentCategory() {
		return currentCategory;
	}

	public void setCurrentCategory(Category currentCategory) {
		this.currentCategory = currentCategory;
	}

}
